package com.wnx.job.modules.pms.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wnx.job.modules.pms.mapper.PmsResumeMapper;
import com.wnx.job.modules.pms.model.PmsResume;
import com.wnx.job.modules.pms.service.PmsResumeService;
import com.wnx.job.modules.rms.dto.ResumeParam;
import com.wnx.job.modules.rms.model.*;
import com.wnx.job.modules.rms.service.*;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wangnaixing
 * @since 2021-12-17
 */
@Service
public class PmsResumeServiceImpl extends ServiceImpl<PmsResumeMapper, PmsResume> implements PmsResumeService {
    @Resource
    private PmsResumeMapper resumeMapper;
    @Resource
    private RmsIntentionService intentionService;
    @Resource
    private RmsProjectService projectService;
    @Resource
    private RmsTrainService trainService;
    @Resource
    private RmsCertificateService certificateService;
    @Resource
    private RmsStudentCadreService studentCadreService;


    /**
     * 根据学生ID查询简历信息
     * @param studentId
     * @return
     */
    @Override
    public ResumeParam findByStudentId(Long studentId) {
        return resumeMapper.findByStudentId(studentId);
    }


    /**
     * 根据ID查询简历详情
     * @param id
     * @return
     */
    @Override
    public ResumeParam findDetailById(Long id) {
        List<RmsIntention> intentions = intentionService.findIntentionListByResumeId(id);
        List<RmsProject> projects = projectService.findProjectListByResumeId(id);
        List<RmsTrain> trains = trainService.findTrainListByResumeId(id);
        List<RmsCertificate>  certificates = certificateService.findCertificateListByResumeId(id);
        List<RmsStudentCadre> studentCadres = studentCadreService.findStudentCadreListByResumeId(id);

        ResumeParam resume = resumeMapper.findDetailById(id);
        resume.setIntentionList(intentions);
        resume.setProjectList(projects);
        resume.setTrainList(trains);
        resume.setCertificateList(certificates);
        resume.setStudentCadreList(studentCadres);

        return resume;

    }
}
